import {BasicColumn} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { router} from '/@/router';
import {h, ref} from "vue";
//列表数据
export const queryParam = ref<any>({});
export const columns: BasicColumn[] = [
  {
    title: '地区名称',
    align: "center",
    dataIndex: 'areaId_dictText'
  },
  {
    title: '项目数量',
    align: "center",
    dataIndex: 'projectTotal'
  },
  {
    title: '保单总数',
    align: "center",
    dataIndex: 'insuranceTotal',
    customRender: function (t) {
      return h(
        'a',
        {
          onClick: function (){
            router.push({name:'insurance-InsuranceOrderList', query: {
                areaId: t.record.areaId,
                policyInsurDateBegin: queryParam.value.statTime,
                policyInsurDateEnd: queryParam.value.endTime,
                insuranceCompany: queryParam.value.company,
                insuranceType: queryParam.value.type
              }})
          },
        },
        t.value
      );
    }
  },
  {
    title: '退保数量',
    align: "center",
    dataIndex: 'surrenderTotal',
    customRender: function (t) {
      return h(
        'a',
        {
          onClick: function (){
            router.push({name:'insurance-InsuranceOrderList', query: {
                areaId: t.record.areaId,
                policyState: 'YTB',
                policyInsurDateBegin: queryParam.value.statTime,
                policyInsurDateEnd: queryParam.value.endTime,
                insuranceCompany: queryParam.value.company,
                insuranceType: queryParam.value.type
              }})
          },
        },
        t.value
      );
    }
  },
  {
    title: '保费总额',
    align: "center",
    dataIndex: 'premiumTotal'
  },
  {
    title: '退保总额',
    align: "center",
    dataIndex: 'surrenderPremiumTotal'
  },
];
